package com.lineage.server.serverpackets;

public class S_CharPacks extends ServerBasePacket {
  private byte[] _byte;
  
  public S_CharPacks(String name, String clanName, int type, int sex, int lawful, int hp, int mp, int ac, int lv, int str, int dex, int con, int wis, int cha, int intel, int time) {
    this._byte = null;
    writeC(93);
    writeS(name);
    writeS(clanName);
    writeC(type);
    writeC(sex);
    writeH(lawful);
    writeH(hp);
    writeH(mp);
    if (ac > 10) {
      writeC(10);
    } else {
      writeC(ac);
    } 
    if (lv > 127) {
      writeC(127);
    } else {
      writeC(lv);
    } 
    writeC(str);
    writeC(dex);
    writeC(con);
    writeC(wis);
    writeC(cha);
    writeC(intel);
    writeC(0);
    String times = Integer.toHexString(time);
    if (times.length() < 8)
      times = "0" + times; 
    writeC(Integer.decode("0x" + times.substring(6, 8)).intValue());
    writeC(Integer.decode("0x" + times.substring(4, 6)).intValue());
    writeC(Integer.decode("0x" + times.substring(2, 4)).intValue());
    writeC(Integer.decode("0x" + times.substring(0, 2)).intValue());
    if (lv > 127)
      lv = 127; 
    int checkcode = lv ^ str ^ dex ^ con ^ wis ^ cha ^ intel;
    writeC(checkcode & 0xFF);
  }
  
  public byte[] getContent() {
    if (this._byte == null)
      this._byte = getBytes(); 
    return this._byte;
  }
  
  public String getType() {
    return getClass().getSimpleName();
  }
}
